﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BSCMFF.Core.DataAccessLayer;
using BSCMFF.Core.Exceptions.Database;

namespace BSCMFF.Web.UserControls.Details
{
    /// <summary>
    /// KPI progress details.
    /// </summary>
    /// <remarks></remarks>
    public partial class KPIProgressDetails : System.Web.UI.UserControl
    {
        /// <summary>
        /// kpi progress.
        /// </summary>
        public KPI_Progress kpip;

        /// <summary>
        /// Gets or sets the KPIP.
        /// </summary>
        /// <value>The KPIP.</value>
        /// <remarks></remarks>
        public KPI_Progress KPIP
        {
            get
            {                
                return kpip;
            }
            set
            {
                kpip = value;
            }
        }


        /// <summary>
        /// Handles the Click event of the RadButtonSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void RadButtonSave_Click(object sender, EventArgs e)
        {
            BSCEntities context = new BSCEntities();
            
            try
            {
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new InconsistentDatabaseException("Couldn't update KPI Progress : " + ex.Message);
            }
        }
    }
}